package com.sh.data.engine.domain.datadev.flink.model.domain;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: zigui.zdf
 * @description:
 * @date: 2021/6/10 17:00
 */
@Data
//@ApiModel
public class KafkaSourceDomain {

    /**
     * topic
     */
//    @ApiModelProperty(value = "topic值")
    private String topic;

    /**
     * 三种值：0-earliest,1-latest,2-time,3 group offset 4 specific offset
     */
//    @ApiModelProperty(value = "三种值：0-latest,1-earliest,和2-time", allowableValues = "0,1,2,3,4")
    private Integer offset;

    /**
     * 启动时间点，offset值为2时生效
     */
//    @ApiModelProperty(value = "启动时间点，offset值为2时生效,格式：yyyy-MM-dd HH:mm:ss")
    private String startPointTime;

    /**
     * 时间特征：0-procTime,1-eventTime
     */
//    @ApiModelProperty(value = "时间特征：0-procTime,1-eventTime")
    private Integer timeType;

    /**
     * timeType值为1时，指定的时间列字段
     */
//    @ApiModelProperty(value = "timeType值为1时，指定的时间列字段")
    private String timeField;

    /**
     * timeType值为1时，指定的延迟时间
     */
//    @ApiModelProperty(value = "timeType值为1时，指定的延迟时间，单位：ms")
    private Integer delayMs;

    //    @ApiModelProperty(value = "kafka字段信息定义")
    private List<kafkaField> kafkaFields;

    /**
     * 当offset是4的时候有用
     */
    private List<FlinkKafkaSourceConfigDomain.PartitionOffset> partitionOffsetList =
        new ArrayList<>();

    @Data
    public static class PartitionOffset {
        private Integer partition;
        private Long offset;
    }

    @Data
//    @ApiModel
    public static class kafkaField {

        //    @ApiModelProperty(value = "字段名")
        private String fieldName;

        //    @ApiModelProperty(value = "表达式")
        private String express;

        //    @ApiModelProperty(value = "字段类型")
        private String filedType;

        //    @ApiModelProperty(value = "字段描述")
        private String fieldDesc;
    }
}
